
import numpy as np # 载入numpy模块，并且取一个缩写名叫做 np
import matplotlib.pyplot as plt

x = np.arange(-5,5,0.1) # np.range(-5,5,0.1) 得到数组 [ -5, -4.9, -4.8, ..., 4.9 ]
y = np.sin( x )
plt.xlabel( "x", fontsize = 15 )
plt.ylabel( "y", fontsize = 15 )
plt.plot(x,y,label = "y = sinx")
plt.xlim(-3,3)
plt.legend()
plt.show()
plt.savefig("xx.jpeg")